<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
    <link rel="stylesheet" th:href="@{/diaShop/css/common.css}" type="text/css"/>
    <link rel="stylesheet" th:href="@{/diaShop/css/style.css}" type="text/css"/>
    <link rel="stylesheet" th:href="@{/diaShop/fonts/iconfont.css}" type="text/css"/>
    <script th:src="@{/diaShop/js/jquery-1.9.1.min.js}" type="text/javascript"></script>
    <script th:src="@{/diaShop/js/jquery.SuperSlide.2.1.1.js}" type="text/javascript"></script>
    <script th:src="@{/diaShop/js/jquery.reveal.js}" type="text/javascript"></script>
    <script th:src="@{/diaShop/js/jquery.sumoselect.min.js}" type="text/javascript"></script>
    <script th:src="@{/diaShop/js/common_js.js}" type="text/javascript"></script>
    <script th:src="@{/diaShop/js/footer.js}" type="text/javascript"></script>
    <script th:src="@{/diaShop/js/jquery.jumpto.js}" type="text/javascript"></script>
    <script th:src="@{/js/layer/layer.js}"></script>
    <title>订单确认</title>
</head>
<script type="text/javascript">
    $(document).ready(function () {
        window.asd = $('.SlectBox').SumoSelect({csvDispCount: 3});
        window.test = $('.testsel').SumoSelect({okCancelInMulti: true});
    });



</script>
<body>
<!--顶部图层-->
<div th:replace="diaShop/layout/mallHeader"></div>

<!--订单确认样式-->
<div class="Inside_pages  clearfix" id="Orders">
    <div class="Process"><img src="/diaShop/images/Process_img_02.png"/></div>
    <div class="Orders_style clearfix">
        <div class="address clearfix">
            <div class="title">收货人信息</div>
            <div class="adderss_list clearfix">
                <div class="title_name">选择收货地址 <a href="#">+添加地址</a></div>
                <div class="list" id="select">
                    <ul th:class="${address.isdefault eq 0 ? 'confirm active':''}" th:each="address:${addressList}"
                        th:label="${address.id}">
                        <div class="default" t:if="${address.isdefault eq 0}">默认地址</div>
                        <div class="adderss_operating">
                            <div class="Operate"><a class="delete_btn" href="#"
                                                    th:onclick="'delAddress('+${address.id}+')'"></a>
                                <a class="modify_btn" href="#" th:onclick="'editAddress('+${address.id}+')'"></a>
                            </div>
                        </div>
                        <div class="user_address">
                            <li th:text="${address.name}">小张</li>
                            <li th:text="${address.detail}">四川成都</li>
                            <li class="Postcode">610043</li>
                            <li th:text="${address.mobile}">18908269130</li>
                        </div>
                    </ul>

                </div>
            </div>
            <!--收货地址样式-->
            <!-- <div class="Shipping_address">
               <ul class="detailed">
                <li><label>收货人姓名</label><span>张晓</span></li>
                <li><label>电子邮件</label><span>4567454@qq.com</span></li>
                <li><label>详细地址</label><span>四川成都武侯区簇景西路20号3栋1单元302号</span></li>
                <li><label>邮政编码</label><span></span></li>
                <li><label>移动电话</label><span></span></li>
                 <li><label>固定电话</label><span></span></li>
               </ul>
             </div>-->
        </div>
        <form class="form" method="post">
            <fieldset>
                <!--快递选择-->
                <div class="express_delivery">
                    <div class="title_name">选择快递方式</div>

                    <ul class="dowebok">
                        <li><input data-labelauty="圆通快递" name="radio" type="radio">
                            <div class="description">
                                <em class="arrow"></em>
                                <p>到付价格=现付价格*1.25 ，不足1元按1元收取，到付最低15元起。此价格供参考，详情请咨询圆通当地营业网点</p>
                                <p>资费：15元</p>
                                <p class="Note">满68元包邮</p>
                                <p><a href="#">点击查看是否在配送范围内</a></p>
                            </div>
                        </li>
                        <li><input data-labelauty="中通快递" name="radio" type="radio">
                            <div class="description">
                                <em class="arrow"></em>
                                <p>到付价格=现付价格*1.25 ，不足1元按1元收取，到付最低15元起。此价格供参考，详情请咨询圆通当地营业网点</p>
                                <p>资费：15元</p>
                                <p class="Note">满68元包邮</p>
                            </div>
                        </li>
                        <li><input data-labelauty="申通快递" name="radio" type="radio">
                            <div class="description">
                                <em class="arrow"></em>
                                <p>到付价格=现付价格*1.25 ，不足1元按1元收取，到付最低15元起。此价格供参考，详情请咨询圆通当地营业网点</p>
                                <p>资费：15元</p>
                                <p class="Note">满68元包邮</p>
                            </div>
                        </li>
                        <li><input data-labelauty="邮政EMS" name="radio" type="radio">
                            <div class="description">
                                <em class="arrow"></em>
                                <p>到付价格=现付价格*1.25 ，不足1元按1元收取，到付最低15元起。此价格供参考，详情请咨询圆通当地营业网点</p>
                                <p>资费：15元</p>
                                <p class="Note">满68元包邮</p>
                            </div>
                        </li>
                        <li><input data-labelauty="城际快递" name="radio" type="radio">
                            <div class="description">
                                <em class="arrow"></em>
                                <p>到付价格=现付价格*1.25 ，不足1元按1元收取，到付最低15元起。此价格供参考，详情请咨询圆通当地营业网点</p>
                                <p>资费：同城包邮</p>

                            </div>
                        </li>
                        <li><input data-labelauty="韵达快递" name="radio" type="radio">
                            <div class="description">
                                <em class="arrow"></em>
                                <p>到付价格=现付价格*1.25 ，不足1元按1元收取，到付最低15元起。此价格供参考，详情请咨询圆通当地营业网点</p>
                                <p>资费：15元</p>
                                <p class="Note">满68元包邮</p>
                            </div>
                        </li>
                        <li><input data-labelauty="国通快递" name="radio" type="radio">
                            <div class="description">
                                <em class="arrow"></em>
                                <p>到付价格=现付价格*1.25 ，不足1元按1元收取，到付最低15元起。此价格供参考，详情请咨询圆通当地营业网点</p>
                                <p>资费：15元</p>
                                <p class="Note">满68元包邮</p>
                            </div>
                        </li>
                        <li><input data-labelauty="顺丰快递" name="radio" type="radio">
                            <div class="description">
                                <em class="arrow"></em>
                                <p>到付价格=现付价格*1.25 ，不足1元按1元收取，到付最低15元起。此价格供参考，详情请咨询圆通当地营业网点</p>
                                <p>资费：15元</p>
                                <p class="Note">满88元包邮</p>
                            </div>
                        </li>
                        <li><input data-labelauty="邮政小包" name="radio" type="radio">
                            <div class="description">
                                <em class="arrow"></em>
                                <p>到付价格=现付价格*1.25 ，不足1元按1元收取，到付最低15元起。此价格供参考，详情请咨询圆通当地营业网点</p>
                                <p>资费：15元</p>
                                <p class="Note">满68元包邮</p>
                            </div>
                        </li>
                        <li><input data-labelauty="天天快递" name="radio" type="radio">
                            <div class="description">
                                <em class="arrow"></em>
                                <p>到付价格=现付价格*1.25 ，不足1元按1元收取，到付最低15元起。此价格供参考，详情请咨询圆通当地营业网点</p>
                                <p>资费：15元</p>
                                <p class="Note">满68元包邮</p>
                            </div>
                        </li>
                    </ul>

                </div>

                <!--付款方式-->
                <div class="payment">
                    <div class="title_name">支付方式</div>
                    <ul>
                        <li><input data-labelauty="余额支付" name="radio1" type="radio"></li>
                        <li><input data-labelauty="支付宝" name="radio1" type="radio"></li>
                        <li><input data-labelauty="财付通" name="radio1" type="radio"></li>
                        <li><input data-labelauty="银联支付" name="radio1" type="radio"></li>
                        <li><input data-labelauty="货到付款" name="radio1" type="radio"></li>
                    </ul>
                </div>
                <!--发票样式
                <div class="invoice_style">
                    <ul>
                        <li class="invoice_left"><input name="" type="checkbox" value="" data-labelauty="是否开发票"/></li>
                        <li class="invoice_left"><select name="somename" class="SlectBox"
                                                         onclick="console.log($(this).val())"
                                                         onchange="console.log('change is firing')">
                            <option disabled="disabled" selected="selected">发票类型</option>
                            <option value="办公用品">办公用品</option>
                            <option value="食品">食品</option>
                            <option value="20元红包">20元红包</option>
                            <option value="50元红包">50元红包</option>
                            <option value="100元红包">100元红包</option>
                            <option value="200元红包">200元红包</option>
                        </select>
                        </li>
                        <li class="invoice_left">发票抬头
                            <input name="" type="text" class="text_info"/></li>
                        <li class="invoice_left">
                            <select name="somename" class="SlectBox" onclick="console.log($(this).val())"
                                    onchange="console.log('change is firing')">
                                <option disabled="disabled" selected="selected">发票内容</option>
                                <option value="办公用品">办公用品</option>
                                <option value="食品">食品</option>
                                <option value="数码配件">数码配件</option>
                                <option value="电脑">电脑</option>
                                <option value="手机">手机</option>
                                <option value="200元红包">200元红包</option>
                            </select>

                        </li>
                    </ul>
                </div>
                -->
                <!--产品列表-->
                <div class="Product_List">
                    <!-- <div class="envelopes">
                         选择已有红包<select name="somename" class="SlectBox" onclick="console.log($(this).val())"
                                       onchange="console.log('change is firing')">
                         <option disabled="disabled" selected="selected">选择红包金额</option>
                         &lt;!&ndash;placeholder&ndash;&gt;
                         <option value="5元红包">5元红包</option>
                         <option value="10元红包">10元红包</option>
                         <option value="20元红包">20元红包</option>
                         <option value="50元红包">50元红包</option>
                         <option value="100元红包">100元红包</option>
                         <option value="200元红包">200元红包</option>
                     </select>
                         或者输入红包序列号<input name="" type="text" class="text_number"/><input type="submit"
                                                                                         class="verification_btn"
                                                                                         value="验证序列号"/>
                     </div>-->
                    <table>
                        <thead>
                        <tr class="title">
                            <td class="name">商品名称</td>
                            <td class="price">商品价格</td>
                            <td class="Preferential">优惠价</td>
                            <td class="Quantity">购买数量</td>
                            <td class="Money">金额</td>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="goods:${cartList}">
                            <td class="Product_info">
                                <a th:href="@{'/diaShop/goodsDetail/'+${goods.goodsid}}">
                                    <img height="100px" src="Product/p_11.jpg" th:src="@{${goods.img}}" width="100px"/></a>
                                <a class="product_name" th:href="@{'/diaShop/goodsDetail/'+${goods.goodsid}}"
                                   th:text="${goods.goodsname}">麻阳冰糖橙子甜橙冰糖柑8斤新鲜水果甜过永兴冰糖橙赣南脐橙包邮</a>
                            </td>
                            <td th:text="'￥'+${goods.price}">123.00</td>
                            <td th:text="'￥'+${goods.price}">112.00</td>
                            <td th:text="${goods.count}">2</td>
                            <td class="Moneys" th:text="'￥'+${goods.totalprice}">224.00</td>
                        </tr>

                        </tbody>
                    </table>
                    <div class="Pay_info">
                        <label>订单留言</label><input class="text_name " name="" onkeyup="checkLength(this);" type="text"/>
                        <span class="wordage">剩余字数：<span id="sy" style="color:Red;">50</span></span>
                    </div>
                    <!--价格-->
                    <div class="price_style">
                        <div class="right_direction">
                            <ul>
                                <li><label>商品总价</label><span th:text="'￥'+${totalprice}">448.00</span></li>
                                <li><label>优惠金额</label><i>￥</i><span>0.00</span></li>
                                <li><label>配&nbsp;&nbsp;送&nbsp;&nbsp;费</label><i>￥</i><span>0</span></li>
                                <li class="shiji_price">
                                    <label>实&nbsp;&nbsp;付&nbsp;&nbsp;款</label><span
                                        th:text="'￥'+${totalprice}">425.00</span></li>
                            </ul>
                            <div class="btn"><input class="submit_btn" name="submit" onclick="submitOrder()"
                                                    type="button" value="提交订单"/> <input
                                    class="return_btn" name="" onclick="toCart()" type="button" value="返回购物车"/></div>
                            <div class="integral right">待订单确认后，你将获得<span>345</span>积分</div>
                        </div>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
</div>
</div>
<div th:replace="diaShop/layout/mallFooter"></div>
<script type="text/javascript">
    function toCart(){
        window.location.href="/person/diaShop/cartList";
    }
    var addressid = 1;
    $(function() {
        $(".user-addresslist").click(function () {
            $(this).addClass("check").siblings().removeClass("check");
            addressid =jQuery(this).attr("label");
        });
    });

    var couponid = $("#couponid").val();
    function submitOrder(){
        var data = {};
        data.totalBlance=$("#totalBlance").html();
        data.addressid=addressid;
        data.couponid=couponid;

        $.ajax({
            type: "post",
            url: '/person/diaShop/submitOrder',
            data: data,
            dataType: "json",
            success:function(res) {
                console.log(res);
                if(res.code==0){
                    var id = res.data.id;
                    window.location.href = "/person/diaShop/pay/"+id;
                }else {
                    layer.msg("订单已提交!",2, 8);
                    window.location.href = "/diaShop/index"
                }
            }
        });
    }
    function checkLength(which) {
        var maxChars = 50; //
        if (which.value.length > maxChars) {
            alert("您出入的字数超多限制!");
            // 超过限制的字数了就将 文本框中的内容按规定的字数 截取
            which.value = which.value.substring(0, maxChars);
            return false;
        } else {
            var curr = maxChars - which.value.length; //250 减去 当前输入的
            document.getElementById("sy").innerHTML = curr.toString();
            return true;
        }
    }



</script>
<script>
    $(function () {
        $(':input').labelauty();
    });



</script>
</body>
</html>
